package welcome.general;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
import java.awt.SystemColor;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.border.EmptyBorder;

public class AboutTool extends JDialog {

	private static final String title = "About Us";

	private static JPanel contentPanel = new JPanel();

	public JPanel getContentPanel(){
		return contentPanel;
	}

	public AboutTool() {
		/* Frame settings. */
		setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
		setBounds(100, 100, 515, 239);

		setIconImage(Toolkit.getDefaultToolkit().getImage("C:\\Users\\F. OMENA\\Dropbox\\Mestrado\\Projeto-Mestrado\\AspectLibrary\\Images\\logo\\logo3.png"));
		setTitle(ChoosePerspective.NAME_APP + " " + ChoosePerspective.VERSION  + " - " + title);
		setLocation(((Toolkit.getDefaultToolkit().getScreenSize().width / 2) - (this.getWidth() / 2)), ((Toolkit.getDefaultToolkit().getScreenSize().height / 2) - (getHeight() / 2)));

		getContentPane().setLayout(new BorderLayout());
		contentPanel.setForeground(new Color(105, 105, 105));
		contentPanel.setBackground(new Color(245, 245, 245));
		contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
		getContentPane().add(contentPanel, BorderLayout.NORTH);
		JButton btnOk = new JButton("OK");
		btnOk.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				setVisible(false);
			}
		});
		btnOk.setBackground(SystemColor.controlHighlight);
		
		/* Information text. */
		JLabel lblDsfsd = new JLabel("Aspect Library for NetLogo Developers and Users");
		lblDsfsd.setForeground(Color.BLACK);
		lblDsfsd.setFont(new Font("Times New Roman", Font.BOLD, 14));

		JLabel lblVersionnov = new JLabel("Version: 1.0 (Nov, 2012).");
		lblVersionnov.setForeground(new Color(0, 0, 128));
		lblVersionnov.setFont(new Font("Tahoma", Font.PLAIN, 11));

		JLabel lblAspectnetlogoGrammarAuthor = new JLabel("AspectNetLogo grammar authors: Diego Siqueira, Felipe Omena");
		lblAspectnetlogoGrammarAuthor.setForeground(Color.BLACK);
		lblAspectnetlogoGrammarAuthor.setFont(new Font("Times New Roman", Font.PLAIN, 13));

		JLabel lblAspectLibrarieAuthor = new JLabel("Aspect Library author: Felipe Omena");
		lblAspectLibrarieAuthor.setForeground(Color.BLACK);
		lblAspectLibrarieAuthor.setFont(new Font("Times New Roman", Font.PLAIN, 13));

		JLabel lblcCopyrightEcomp = new JLabel("(c) Copyright eComp, 2012.  All rights reserved.");
		lblcCopyrightEcomp.setForeground(new Color(0, 0, 128));
		lblcCopyrightEcomp.setFont(new Font("Tahoma", Font.PLAIN, 11));

		JLabel lblNewLabel = new JLabel("");
		lblNewLabel.setIcon(new ImageIcon("C:\\Users\\F. OMENA\\Dropbox\\Mestrado\\Projeto-Mestrado\\AspectLibrary\\Images\\logo\\logo3.png"));
		
		/* Layout */
		GroupLayout gl_contentPanel = new GroupLayout(contentPanel);
		gl_contentPanel.setHorizontalGroup(
				gl_contentPanel.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_contentPanel.createSequentialGroup()
						.addGap(34)
						.addGroup(gl_contentPanel.createParallelGroup(Alignment.LEADING)
								.addComponent(lblDsfsd)
								.addGroup(gl_contentPanel.createSequentialGroup()
										.addComponent(lblNewLabel)
										.addPreferredGap(ComponentPlacement.UNRELATED)
										.addGroup(gl_contentPanel.createParallelGroup(Alignment.LEADING)
												.addComponent(lblAspectLibrarieAuthor, GroupLayout.PREFERRED_SIZE, 239, GroupLayout.PREFERRED_SIZE)
												.addComponent(lblVersionnov, GroupLayout.PREFERRED_SIZE, 239, GroupLayout.PREFERRED_SIZE)
												.addComponent(lblAspectnetlogoGrammarAuthor, GroupLayout.PREFERRED_SIZE, 359, GroupLayout.PREFERRED_SIZE)))
												.addComponent(lblcCopyrightEcomp, GroupLayout.PREFERRED_SIZE, 333, GroupLayout.PREFERRED_SIZE))
												.addContainerGap())
												.addGroup(Alignment.TRAILING, gl_contentPanel.createSequentialGroup()
														.addContainerGap(214, Short.MAX_VALUE)
														.addComponent(btnOk, GroupLayout.PREFERRED_SIZE, 78, GroupLayout.PREFERRED_SIZE)
														.addGap(200))
				);
		gl_contentPanel.setVerticalGroup(
				gl_contentPanel.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_contentPanel.createSequentialGroup()
						.addContainerGap()
						.addComponent(lblDsfsd)
						.addGap(18)
						.addGroup(gl_contentPanel.createParallelGroup(Alignment.LEADING)
								.addComponent(lblNewLabel)
								.addGroup(gl_contentPanel.createSequentialGroup()
										.addComponent(lblVersionnov)
										.addGap(18)
										.addComponent(lblAspectnetlogoGrammarAuthor)
										.addPreferredGap(ComponentPlacement.RELATED)
										.addComponent(lblAspectLibrarieAuthor)))
										.addGap(18)
										.addComponent(lblcCopyrightEcomp)
										.addPreferredGap(ComponentPlacement.RELATED, 12, Short.MAX_VALUE)
										.addComponent(btnOk)
										.addContainerGap())
				);
		contentPanel.setLayout(gl_contentPanel);
	}

}
